package com.lm.geodesy.example;

import org.gavaghan.geodesy.*;

public class GeodesyExample {
    public static void main(String[] args) {
        // 定义两个地理位置 (经度, 纬度)
        GlobalCoordinates pointA = new GlobalCoordinates(34.052235, -118.243683); // 洛杉矶
        GlobalCoordinates pointB = new GlobalCoordinates(40.712776, -74.005974); // 纽约

        // 使用 WGS84 椭球体
        GeodeticCalculator calculator = new GeodeticCalculator();
        Ellipsoid reference = Ellipsoid.WGS84;

        // 计算距离（米）
        GeodeticCurve curve = calculator.calculateGeodeticCurve(reference, pointA, pointB);
        double distance = curve.getEllipsoidalDistance();

        System.out.println("洛杉矶到纽约的距离: " + distance / 1000 + " 公里");
    }
}

